// iterator demo
// Created by Administrator on 2025/6/25.
// 迭代器的应用

#include <iostream>
#include <vector>
using namespace std;

int main(int argc, char *argv[]) {
    vector<int> vec = {1, 2, 3, 4, 5};

    cout << "遍历 vec 容器：" << "\t";
    for (vector<int>::iterator it = vec.begin(); it != vec.end(); ++it) {
        cout << *it << "\t";
    }
    cout << endl;

    cout << "遍历 vec 容器：" << "\t";
    for (auto it = vec.begin(); it != vec.end(); ++it) {
        cout << *it << "\t";
    }
    cout << endl;

    cout << "遍历 vec 容器：" << "\t";
    for (const int& i: vec) {
        cout << i << "\t";
    }
    cout << endl;
}
